<?php
/**
 * Created by PhpStorm.
 * User: 13469
 * Date: 2018/10/12
 * Time: 19:21
 */
include "config.php";
$sql="SELECT *FROM carts WHERE u_id=?;";
$res=$conn->prepare($sql);
$res->bind_param("i",$_REQUEST["uid"]);
$res->execute();
$rs=$res->get_result();
$arr=array();

while($row=$rs->fetch_assoc()){
    array_push($arr,$row);
}

print_r(json_encode($arr));